package MyUtils;

import 其他.DataStructure.ListNode;

import java.util.List;

public class ListUtils {
    /**
     * 区间题：
     *  eg.[1,2],[3,4],[3,6]
     *  List<int[2]> -> [][]
     */
    public static int[][] scopeListToShuZu(List<int[]> list){
        int n = list.size();
        int[][] res = new int[n][2];
        for (int i = 0; i < n; i++) {
            res[i][0] = list.get(i)[0];
            res[i][1] = list.get(i)[1];
        }
        return res;
    }

    /**
     * 打印链表
     */
    public static void ptListByHead(ListNode head){
        while(head != null){
            System.out.print(head + " ");
        }
        System.out.println();
    }
}
